ConditionVirtualization= checks if systemd runs in some sort of guest.
It is not supposed to detect host capabilities. The current
implementation happens to work because systemd-detect-virt from v208
returns also 'xen' in a dom0. In v210 and later 'none' is returned and
no service files will be started.
Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs
depends on /proc/xen, but should only be done for pvops because xenfs
exists only there. All other service files should not be started in
domU. The file /proc/xen/capabilities exists in both dom0 and domU in a
pvops kernel, but only in dom0 it contains 'control_d'. The existing
ExecStartPre= check will prevent starting in a domU.
ConditionVirtualization=!xen is true in a dom0. But this check is broken
in systemd v208, so its not used.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[Unit]
Description=Mount /proc/xen files
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen
+ConditionPathExists=!/proc/xen/capabilities
RefuseManualStop=true
[Mount]
[Unit]
Description=mount xenstore file system
-ConditionVirtualization=xen
+Requires=proc-xen.mount
+After=proc-xen.mount
+ConditionPathExists=/proc/xen/capabilities
RefuseManualStop=true
[Mount]
After=xenstored.service xenconsoled.service
Before=xendomains.service libvirtd.service libvirt-guests.service
RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=simple
Description=Xen-watchdog - run xen watchdog daemon
Requires=proc-xen.mount
After=proc-xen.mount xendomains.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=forking
Description=Xenconsoled - handles logging from guest consoles and hypervisor
Requires=xenstored.socket
After=xenstored.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=simple
Description=Xendomains - start and stop guests on boot and shutdown
Requires=xenstored.socket
After=xenstored.service xenconsoled.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=oneshot
After=proc-xen.mount var-lib-xenstored.mount
Before=libvirtd.service libvirt-guests.service
RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=notify
[Unit]
Description=xenstore socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Socket]
ListenStream=/var/run/xenstored/socket
[Unit]
Description=xenstore ro socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Socket]
ListenStream=/var/run/xenstored/socket_ro